<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <button @click = "isHot = !isHot">点击</button>
    {{isHot}}
  </div>
  <script>
    Vue.config.productionTip = false;

    const vm = new Vue({
      el: "#app",
      data() {
        return {
          isHot: true
        }
      },
      /* 
            在vue实例vm上有一个$watch方法 也可以处理对vm实例上的属性进行监听
            参数1:被监听的属性
            参数2:回调函数
            参数3:配置对象  deep immediate
      */
      
    })
    vm.$watch("isHot" , ()=>{
      console.log("isHot执行了");
    } , {deep:true , immediate:true})
  </script>
</body>

</html>